package cn.liutao.auth.entity.po;

import cn.liutao.common.entity.BaseEntity;
import cn.liutao.common.entity.Validation;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 用户表 实体类。
 *
 * @author liutao
 * @since 2023-10-31
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "user")
public class User extends BaseEntity implements Serializable {

    @Id(keyType = KeyType.Auto)
    @NotNull(message = "请选择要修改的用户",groups = Validation.EditGroup.class)
    private Integer id;

    @NotBlank(message = "昵称不能为空",groups = Validation.AddGroup.class)
    private String nickName;

    /**
     * 用户名
     */
    @NotBlank(message = "用户名不能为空",groups = Validation.AddGroup.class)
    private String username;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空",groups = Validation.AddGroup.class)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)//只在序列化时生效
    private String password;

    /**
     * 支付密码
     */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)//只在序列化时生效
    private String payPassword;

    /**
     * 是否为管理员，0：否，1：是
     */
    private Integer isAdmin;

    /**
     * 账户余额
     */
    private BigDecimal balance;

    /**
     * 头像
     */

    private String avatar;

}
